Hệ thống quản lý thanh toán POS nhà hàng

1 Imports System.Data.OleDb
2 Public Class frmNotes
3     Declare Function Wow64DisableWow64FsRedirection Lib
"kernel32" (ByRef oldvalue As Long) As Boolean
4     Declare Function Wow64EnableWow64FsRedirection Lib
"kernel32" (ByRef oldvalue As Long) As Boolean
5
6     Private Sub btnClose_Click(sender As System.Object, e As System.EventArgs) Handles btnClose.Click
7         txtNotes.Text =
""
8         Me.Close()
9     End Sub
10     Public Sub Getdata()
11         Try
12             con = New OleDbConnection(cs)
13             con.Open()
14             cmd = New OleDbCommand(
"SELECT RTRIM(Notes) from NotesMaster order by Notes", con)
15             rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
16             dgw.Rows.Clear()
17             While (rdr.Read() = True)
18                 dgw.Rows.Add(rdr(
0))
19             End While
20             con.Close()
21         Catch ex As Exception
22             MessageBox.Show(ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
23         End Try
24     End Sub
25     Private Sub btnGetData_Click(sender As System.Object, e As System.EventArgs) Handles btnOkay.Click
26             Me.Hide()
27             frmBillling.Show()
28             For Each r As DataGridViewRow In frmBillling.DataGridView1.SelectedRows
29                 r.Cells(
14).Value = txtNotes.Text
30                 txtNotes.Text =
""
31             Next
32     End Sub
33     Sub Reset()
34         txtNotes.Text =
""
35     End Sub
36     Private Sub btnKeyboard_Click(sender As System.Object, e As System.EventArgs) Handles btnKeyboard.Click
37         Process.Start(
"osk.exe")
38     End Sub
39
40     Private Sub dgw_MouseClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles dgw.MouseClick
41         Try
42             If dgw.Rows.Count >
0 Then
43                 Dim dr As DataGridViewRow = dgw.SelectedRows(
0)
44                 txtNotes.Text += dr.Cells(
0).Value.ToString() & vbCrLf
45             End If
46         Catch ex As Exception
47             MessageBox.Show(ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
48         End Try
49     End Sub
50
51     Private Sub dgw_RowPostPaint(sender As Object, e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) Handles dgw.RowPostPaint
52         Dim strRowNumber As String = (e.RowIndex +
1).ToString()
53         Dim size As SizeF = e.Graphics.MeasureString(strRowNumber, Me.Font)
54         If dgw.RowHeadersWidth < Convert.ToInt32((size.Width +
20)) Then
55             dgw.RowHeadersWidth = Convert.ToInt32((size.Width +
20))
56         End If
57         Dim b As Brush = SystemBrushes.ControlText
58         e.Graphics.DrawString(strRowNumber, Me.Font, b, e.RowBounds.Location.X +
15, e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) / 2))
59
60     End Sub
61
62     Private Sub frmNotes_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
63         Getdata()
64     End Sub
65
66     Private Sub btnClear_Click(sender As System.Object, e As System.EventArgs) Handles btnClear.Click
67         txtNotes.Text =
""
68     End Sub
69
70     Private Sub frmNotes_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
71         txtNotes.Text =
""
72     End Sub
73 End Class


Gõ tìm kiếm nhanh...